#include<cstdio>
#include<cstring>
#include<algorithm>
#define INF 0x3f3f3f3f
using namespace std;
typedef long long LL;
typedef double db;
inline int read()
{
	int x=0,f=1;
	char ch=getchar();
	while(ch<'0'||ch>'9') { if(ch=='-')f=-1; ch=getchar(); }
	while(ch>='0'&&ch<='9') { x=(x<<1)+(x<<3)+ch-'0'; ch=getchar(); }
	return x*f;
}
const int MAXN=51,MAXL=5010;
int n,c[MAXN],mx,f[MAXN][MAXL];
int main()
{
	n=read();
	int st=read();f[0][st]=1;
	mx=read();
	for(int i=1;i<=n;++i)c[i]=read();
	for(int i=1;i<=n;++i)
		for(int j=0;j<=mx;++j)
		{
			if(j-c[i]>=0&&f[i-1][j-c[i]])f[i][j]=1;
			if(j+c[i]<=mx&&f[i-1][j+c[i]])f[i][j]=1;
		}
	for(int i=mx;~i;--i)
		if(f[n][i])
		{
			printf("%d\n",i);
			return 0;
		}
	puts("-1");
	return 0;
}
